package com.example.client;

import org.apache.ignite.IgniteJdbcThinDataSource;

import javax.cache.configuration.Factory;
import javax.sql.DataSource;
import java.sql.SQLException;

public class ClientDataSourceFactory implements Factory<DataSource> {

    @Override
    public DataSource create(){
        // Or open connection via DataSource.
        IgniteJdbcThinDataSource ids = new IgniteJdbcThinDataSource();
        try {
            ids.setUrl("jdbc:ignite:thin://127.0.0.1/");
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        ids.setDistributedJoins(true);

        return ids;
    }
}
